//
// Copyright (C) [2024] Xingyun Integrated Circuit, Inc.
//
// GreenCode was a private technology asset of Xingyun Integrated Circuit， Inc （Confidential）
//  Author: Shawn.Tan
//  Date : 2025.10.28
//
//  History : Initial Version 2025.10.28
//
//
#ifndef FORCE_MEMORYATTRIBUTES_H
#define FORCE_MEMORYATTRIBUTES_H

#include <string>

#include "Defines.h"
#include "Enums.h"
#include "PagingChoicesAdapter.h"
#include "Register.h"
#include ARCH_ENUM_HEADER

namespace Green
{

  /*!
    \class MemoryAttributes
    \brief Generic interface definition for interacting with architectural and implementation specific memory attributes
  */
  class MemoryAttributes
  {
  public:
    MemoryAttributes() { }
    virtual ~MemoryAttributes() { }
    ASSIGNMENT_OPERATOR_ABSENT(MemoryAttributes);
    COPY_CONSTRUCTOR_ABSENT(MemoryAttributes);

    virtual void   Initialize(const RegisterFile* pRegisterFile, const PagingChoicesAdapter& rChoicesAdapter, const std::string& rMairName) = 0; //!< Initialize memory attributes.
    virtual void   Reload(const RegisterFile* pRegisterFile, const PagingChoicesAdapter& rChoicesAdapter, const std::string& rMairName) = 0; //!< Reload memory attributes.
    virtual uint64 Value() const = 0; //!< Return memory attributes value.

    virtual const ConstraintSet* ArchTypeConstraint() const = 0; //!< Return arch memory attribute type constraint.
    virtual const ConstraintSet* ImplTypeConstraint() const = 0; //!< Return impl memory attribute type constraint.

    virtual uint32 ArchTypeToIndex(uint32 archType) const = 0; //!< Return an index value with matching arch memory attribute type.
    virtual uint32 ImplTypeToIndex(EMemAttributeImplType implType) const = 0; //!< Return an index value with matching impl memory attribute type.
    virtual EMemAttributeImplType ArchTypeToImplType(uint32 archType) const = 0; //!< Convert architectural memory attribute type to implementation defined type.
    virtual EMemAttributeImplType GetImplMemoryTypeByIndex(uint32 index) const = 0; //!< Return implementation defined memory attribute by index.
    virtual EMemAttributeImplType ChooseMemoryAttribute(const PagingChoicesAdapter& rChoicesAdapter, EExceptionConstraintType exceptConstrType, uint32& index) const = 0; //!< Choose a memory attribute based on choices settings.
    virtual const std::map<std::string, uint64>& GetAttributeList() const = 0; //!< return map of attribute names->value
    virtual uint32 GetArchChoiceValue(uint32 archType) const = 0; //!< return arch choice value for given archType
  };

}
#endif //FORCE_MEMORYATTRIBUTES_H
